<?php
/**
 * 汽车官网控制器
 *
 * @package    app
 * @version    1.0
 * @author     Ray 33705910@qq.com
 * @license    MIT License
 * @copyright  2013 - 2015 Ray
 * @link       http://wangxiaolei.cn
 */

/**
 * 本控制器主要用于：
 * 1.手机端
 * @package  app
 * @extends  Controller
 */
namespace mobile;

class Controller_BaseController extends \Controller_BaseController {

    public $template = "template";

    public function before(){
    	parent::before();
    	$seller = \Model_Seller::find(1);
        \Session::set('seller', $seller);

        //读取全局配置项
        if(!\Session::get('GLOBAL_OPTIONS', false)){
            $this->init_global_params();
        }


        \View::set_global('GLOBAL_OPTIONS', \Session::get('GLOBAL_OPTIONS'));
    }

    /**
    *   初始化全局参数 
    **/
    protected function init_global_params(){
        $items = \Model_Option::query()->get();
        $options = array();
        foreach ($items as $key => $value) {
            $options[$value->key] = $value->value;
        }
        $options["baiduMap"] = array("map"=>array("open"=>true,"name"=>"在线地图","city"=>"上海市","mark"=>"","d_address"=>"徐汇区田林东路75号"));
        \Session::set('GLOBAL_OPTIONS', $options);
    }
}